#ifndef PEAKFILEGENERATOR_H
#define PEAKFILEGENERATOR_H
//
#include "datafile.h"
//
template <class T>
class PeakFileGenerator
{
public:
	PeakFileGenerator( QDataStream * file, qint64 samplPerChan, int chans, int samplPerBlock, DataFile::DataTypes dataType );
	~PeakFileGenerator();
	void processSamples( T * sample );
	void end();

private:
	PeakFileGenerator( QDataStream * file, int level, int chans, int samplPerBlock );
	void savePos();
	void restorePos();
	void processData( T * minSample, T * maxSample );

	PeakFileGenerator * peakGen;
	QDataStream * peakFile;
	qint64 position;
	int channels;
	int blockSize;
	qint64 dataCount, dataWritten;
	T * min, * max;
	int index;
};
#endif
